//
//  ILBleObject+RNAPIExtension.h
//  IMILabKit
//
//  Created by OrrHsiao on 2022/4/14.
//

#import "ILBleObject.h"

NS_ASSUME_NONNULL_BEGIN

@interface ILBleObject (RNAPIExtension)

/// NSData->16进制支付串
/// @param data data
- (NSString *)rnapi_dataToHexString:(NSData *)data;

/// 16进制字符串->NSData
/// @param str 16进制字符串
- (NSData *)rnapi_hexStringToData:(NSString *)str;

/// 开始扫描蓝牙设备
/// @param timeout 超时时间 秒
/// @param allowDuplicates 表示是否重复扫描已发现的设备
/// @param serviceUUIDs UUIDs
- (void)rnapi_startScan:(short)timeout allowDuplicates:(BOOL)allowDuplicates serviceUUIDs:(NSArray <NSString *>*)serviceUUIDs;

/// 断开与指定外设的连接
/// @param p ILBlePeripheral
- (void)rnapi_disconnectPeripheral:(ILBlePeripheral *)p;

/// ILBlePeripheral数组转化为Dic数组
/// @param bleDevices ILBlePeripheral数组
- (NSArray *)rnapi_convertPeripherals:(NSArray<ILBlePeripheral *> *)bleDevices;

/// ILBlePeripheral转化为Dic
/// @param obj ILBlePeripheral数组
- (NSDictionary *)rnapi_convertPeripheral:(ILBlePeripheral *)obj;

/// CBService数组转化为UUIDString数组
/// @param cbServices CBService
- (NSArray *)rnapi_convertServices:(NSArray<CBService *> *)cbServices;

/// CBCharacteristic数组转化为UUIDString数组
/// @param cbCharacteristic CBCharacteristic
- (NSArray *)rnapi_convertCharacteristics:(NSArray<CBCharacteristic *> *)cbCharacteristic;

/// CBDescriptor数组转化为UUIDString数组
/// @param cbDescriptors CBDescriptor
- (NSArray *)rnapi_convertDescriptors:(NSArray<CBDescriptor *> *)cbDescriptors;

@end

NS_ASSUME_NONNULL_END
